/*
 * @Author: your name
 * @Date: 2020-08-25 20:35:05
 * @LastEditTime: 2020-08-26 21:12:21
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \examlist\src\store\showUser\index.js
 */
import { getUrl } from '../../utils/https'

const state = {
  data: [],
  columns: [
    [
      {
        title: '用户名',
        key: 'user_name'
      }, {
        title: '密码',
        key: 'user_pwd'
      }, {
        title: '身份',
        key: 'identity_text'
      }
    ],
    [
      {
        title: '身份名称',
        key: 'identity_text'
      }
    ],
    [
      {
        title: 'api权限名称',
        key: 'api_authority_text'
      }, {
        title: 'api权限url',
        key: 'api_authority_url'
      }, {
        title: 'api权限方法',
        key: 'api_authority_method'
      }
    ],
    [
      {
        title: '身份名称',
        key: 'identity_text'
      }, {
        title: 'api权限名称',
        key: 'api_authority_text'
      }, {
        title: 'api权限url',
        key: 'api_authority_url'
      }, {
        title: 'api权限方法',
        key: 'api_authority_method'
      }], [{
      title: '视图权限名称',
      key: 'view_authority_text'
    }, {
      title: '视图id',
      key: 'view_id'
    }
    ],
    [
      {
        title: '身份',
        key: 'identity_text'
      }, {
        title: '视图名称',
        key: 'view_authority_text'
      }, {
        title: '视图id',
        key: 'view_id'
      }
    ]
  ],
  list: []
}

const mutations = {

}
const actions = {
  async getList({ commit }, action) {
    const { data: res } = await getUrl(action.url)
    state.data = res.data
    state.list = state.columns[action.index]
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
